package com.itheima.dao;

import com.itheima.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;


import java.util.List;

/**
 * 产品
 */

public interface IProductDao {
    /**
     * 查询所有产品
     * @return
     */
    @Select("select * from product")
    public List<Product> findAll();

    /**
     * 添加产品
     * @param product
     */
    @Insert("insert into product (productNum,productName,cityName,departureTime,productPrice,productDesc,productStatus) " +
            " values(#{productNum},#{productName},#{cityName},#{departureTime},#{productPrice},#{productDesc},#{productStatus})")
    public void save(Product product);

    /**
     * 根据id查询产品
     * @param id
     * @return
     */
    @Select("select * from product where id = #{id}")
    public Product findById(String id);
}
